package net.helix.engine;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.SlickException;

import net.helix.engine.library.LibraryTreeNode;
import net.helix.ui.UIEngine;
import net.helix.ui.UIEngineTop;
import net.helix.ui.UIHomeScreen;
import net.helix.ui.UIImages;

public class EngineTop {
	/**
	 * Called once to start the entire program.
	 */
	public static void Start(){
		
		
		try {
			AppGameContainer.enableSharedContext();
		} catch (SlickException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		// load all of the images used in the UI
		// TODO: make a preloader... Images and other assets are loaded there
		UIImages.Start();
		
		// Creates the main window
		UIEngineTop.Start();
		
		UIEngineTop.setMenu(UIEngineTop.getDefaultMenu());
		
		// Creates the welcome screen
		new UIHomeScreen();
		// Sets up an untitled project
		// newProject();
		// Finally show the main window
		UIEngineTop.frame.setVisible(true);
	}
	private static LibraryTreeNode[] libraryTransferalbeData = null;
	public static void setLibraryTransferableData(LibraryTreeNode[] data){
		libraryTransferalbeData = data;
	}
	public static LibraryTreeNode[] getLibraryTransferableData(){
		 return libraryTransferalbeData;
	}
	public static void newProject(){
		new UIEngine((new Engine(UIEngineTop.frame)).loadInitialTemplate());
	}
}
